<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item> <i class="el-icon-lx-calendar"></i> 工资管理 </el-breadcrumb-item>
                <el-breadcrumb-item>工资详情</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" :model="form" label-width="100px">

                    <el-divider content-position="left">员工信息</el-divider>

                    <el-form-item label="员工编号" prop="tid">
                        <el-input v-model="form.tid" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="员工姓名" prop="name">
                        <el-input v-model="form.name" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="员工职位" prop="positionName">
                        <el-input v-model="position.name" disabled></el-input>
                    </el-form-item>

                    <el-divider content-position="left">工资信息</el-divider>

                    <el-form-item label="发放日期">
                        <el-date-picker
                        v-model="form.date"
                        format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd"
                        type="date"
                        placeholder="选择日期"
                        disabled
                        >
                        </el-date-picker>
                    </el-form-item>

                    <el-form-item label="基础工资" prop="basicSalary">
                        <el-input v-model="form.basicSalary" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="全勤奖" prop="fullAttention">
                        <el-input v-model="form.fullAttention" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="岗位补贴/月" prop="positionSalary">
                        <el-input v-model="form.positionSalary" disabled></el-input>
                    </el-form-item>
                   
                   <el-form-item label="其他补贴/月" prop="subsidy">
                        <el-input v-model="form.subsidy" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="加班(小时)" prop="overTime">
                        <el-input v-model="form.overTime" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="加班工资" prop="positionName">
                        <el-input v-model="form.overTimeSalary" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="应发工资" prop="totalPay">
                        <el-input v-model="form.totalPay" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="请假(天)" prop="leaveTime">
                        <el-input v-model="form.leaveTime" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="请假应扣" prop="leaveDeduction">
                        <el-input v-model="form.leaveDeduction" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="迟到(小时)" prop="lateTime">
                        <el-input v-model="form.lateTime" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="迟到应扣" prop="lateDeduction">
                        <el-input v-model="form.lateDeduction" disabled></el-input>
                    </el-form-item>
                   
                   <el-form-item label="早退(小时)" prop="earlyTime">
                        <el-input v-model="form.earlyTime" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="早退应扣" prop="earlyDeduction">
                        <el-input v-model="form.earlyDeduction" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="缺勤(天)" prop="absenceDay">
                        <el-input v-model="form.absenceDay" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="缺勤应扣" prop="otherDeduction">
                        <el-input v-model="form.otherDeduction" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="税率" prop="taxRate">
                        <el-input v-model="form.taxRate" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="应扣税费" prop="taxSalary">
                        <el-input v-model="form.taxSalary" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="应扣" prop="totalDeduction">
                        <el-input v-model="form.totalDeduction" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="实发" prop="total">
                        <el-input v-model="form.total" disabled></el-input>
                    </el-form-item>

                    <el-form-item label="状态" prop="result">
                        <el-switch
                            style="display: block"
                            v-model="form.result"
                            active-color="#13ce66"
                            inactive-color="#ff4949"
                            active-value="01"
                            inactive-value="00"
                            active-text="已发"
                            inactive-text="未发"
                            disabled>
                        </el-switch>
                    </el-form-item>

                 

                    <el-form-item>
                        <el-button @click="goback" icon="el-icon-arrow-left">返回</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'baseform',
    inject: ['reload'],
    data() {
        return {
            id: this.$route.query.id,
            position:{},
            form: {
            }
        };
    },
    created: function () {
        this.init();
    },
    methods: {
        goback() {
            this.$router.go(-1);
        },
        async init() {
            var a = await this.$http.get('/salary/' + this.id);

            if (a.code == 200) {
                this.form = a.data;
                this.$message.success(a.message);
                this.getPosition(this.form.pid)
            } else {
                this.$message.error(a.message);
            }
        },
        async getPosition(id){
            var d = await this.$http.get("/position/"+id);
               if(d.code==200){
                   this.position=d.data;
               }
        }
    }
};
</script>